package okl.tdf.app.model
{
	import mx.controls.Alert;
	
	import okl.tdf.app.controller.messages.FeedResultMessage;

	/**
	 *	@author "oleksandr.kulinchenko@gmail.com"
	 */
	public class AppModel
	{
		public function AppModel()
		{
		}
		
		public static const STATE_INACTIVE:String="inactive";
		public static const STATE_ACTIVE:String="active";
		public static const STATE_WAITING:String="waiting";
		[Bindable]public var feedState:String=STATE_INACTIVE;
		
		/**
		 * Process unsubscribe and fault messages from service 
		 */
		[MessageHandler]public function processSampleRequest(message:FeedResultMessage):void{
			if(!message.subscribed){
				feedState = STATE_INACTIVE;
			}
			
			if(message.error!=null){
				feedState = STATE_INACTIVE;
				Alert.show("Messaging error:" + message.error.toString());
			}
		}
		
	}
}